package com.eliza.spring.cloud.nacos.controller

import com.eliza.spring.cloud.nacos.service.UserService
import com.eliza.spring.cloud.library.pojo.User
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController


@RestController
@RequestMapping("/user")
class UserController {
    @Autowired
    private lateinit var userService: UserService

    /**
     * 路径： /user/110
     *
     * @param id 用户id
     * @return 用户
     */
    @GetMapping("/{id}")
    fun queryById(@PathVariable("id") id: Long): User? {
        return userService.queryByUserId(id)
    }
}
